package cn.wolfcode.business.controller;

import cn.wolfcode.business.domain.DriverInfo;
import cn.wolfcode.business.service.DriverInfoService;
import cn.wolfcode.common.core.controller.BaseController;
import cn.wolfcode.common.core.domain.AjaxResult;
import cn.wolfcode.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/business/driveInfo")
public class DriverInfoController extends BaseController {
    @Autowired
    private DriverInfoService driverInfoService;

    @GetMapping("/list")
    public TableDataInfo list(DriverInfo driverInfo){
        startPage();
        List<DriverInfo> list=driverInfoService.selectDriverInfoList(driverInfo);
        return getDataTable(list);
    }

    @PostMapping()
    public AjaxResult add(@RequestBody DriverInfo driverInfo){
        return toAjax(driverInfoService.insertDriverInfo(driverInfo));
    }
    @GetMapping("/{id}")
    public AjaxResult getInfoById(@PathVariable("id") Integer id){
        return AjaxResult.success(driverInfoService.selectDriverInfoById(id));
    }
    @PutMapping()
    public AjaxResult update(@RequestBody DriverInfo driverInfo){
        return toAjax(driverInfoService.updateDriverInfo(driverInfo));
    }
    @DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Integer id){
        return toAjax(driverInfoService.deleteDriverInfoByIds(id));
    }
    //添加反馈信息
    @PostMapping("/fankuixinxi")
    public AjaxResult addFankui(@RequestBody DriverInfo driverInfo){
        return toAjax(driverInfoService.addfankui(driverInfo));
    }





}
